package com.dragonsoftbravo.sqlbuilder.sql.sub;

import com.dragonsoftbravo.sqlbuilder.SqlContext;

import java.util.Arrays;


public class SqlOrderBy implements OrderBy {
    StringBuilder sqlBuilder;

    public SqlOrderBy(StringBuilder sqlBuilder) {
        this.sqlBuilder = sqlBuilder;
        this.sqlBuilder.append(" ORDER BY");
    }

    @Override
    public OrderByConst desc(String column) {
        sqlBuilder.append(" ").append(SqlContext.getColumn(column)).append(" DESC,");
        return new SqlOrderByConst(sqlBuilder);
    }

    @Override
    public OrderByConst asc(String column) {
        sqlBuilder.append(" ").append(SqlContext.getColumn(column)).append(" ASC,");
        return new SqlOrderByConst(sqlBuilder);
    }
}
